; 这个解法对很多数字会形成震荡
; 如 27,125
(define (cube-root x)
        (cube-root-iter 2.0 x)
)

(define (cube-root-iter guess x)
    (begin
        (newline)
        (display "guess=")
        (display guess)
        (display ",x=")
        (display x)
        (newline)    
        (if (good-enough? guess x)
            guess
            (cube-root-iter (improve guess x)
                            x)
        )
    )     
)

(define (improve x y)
        (/  (+  (/ x (* y y))
                (* 2 y))
            3
        )
    
)
(define (good-enough? guess x)
        (< (abs (- (*  guess guess guess)
                    x
                )
            )
            0.001
        )   
)

(display (cube-root 27))
(exit)